package com.ccit.greenlife.utils;
import java.util.HashMap;
import java.util.Map;

public class Exp {
    public static Map<String, Integer> getExp(int Level, int Exp, int newExp) {
        int totalExp = Level * 500;
        int nowExp = Exp + newExp;
        Map<String, Integer> resultMap = new HashMap<>();

        if (nowExp >= totalExp) {
            Level += 1;
            Exp = nowExp % totalExp;
        } else {
            Exp = nowExp;
        }

        resultMap.put("level", Level);
        resultMap.put("exp", Exp);

        return resultMap;
    }


    public static void main(String[] args) {
        Map<String, Integer> resultMap = getExp(2, 700, 310);
        System.out.println("现在的等级" + resultMap.get("level"));
        System.out.println("现在的经验" + resultMap.get("exp"));
    }

}
